package com.baizhi.method;

public class ThreadDemo01 {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();
        System.out.println(main);

        MyThread t1 = new MyThread();
        t1.start();

        MyThread t2 = new MyThread();
        t2.start();

        MyThread t3 = new MyThread();
        t3.start();

        MyThread t4 = new MyThread("最牛线程");
        t4.start();
        System.out.println(t4.getName());
    }
}


class MyThread extends Thread{

    public MyThread() {
    }

    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            System.out.println(Thread.currentThread());
        }
    }
}
